// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial

TestCase := TextInput {
    width: 100phx;
    height: 100phx;
    property<string> test_text: self.text;
    property<int> test_cursor_pos: self.cursor_position_byte_offset;
    property<int> test_anchor_pos: self.anchor_position_byte_offset;
    property<bool> has_selection: self.test_cursor_pos != self.test_anchor_pos;
    property<bool> input_focused: self.has_focus;
}

/*
```rust

let instance = TestCase::new().unwrap();
slint_testing::send_mouse_click(&instance, 50., 50.);
assert!(instance.get_input_focused());
assert_eq!(instance.get_test_text(), "");
slint_testing::send_keyboard_string_sequence(&instance, "Test");
assert_eq!(instance.get_test_text(), "Test");
assert!(!instance.get_has_selection());

slint_testing::send_keyboard_char(&instance, slint::private_unstable_api::re_exports::Key::Control.into(), true);
slint_testing::send_keyboard_string_sequence(&instance, "a");
slint_testing::send_keyboard_char(&instance, slint::private_unstable_api::re_exports::Key::Control.into(), true);
assert!(instance.get_has_selection());
assert_eq!(instance.get_test_cursor_pos(), 4);
assert_eq!(instance.get_test_anchor_pos(), 0);
```
*/
